package net.lanelife.casino.common.utils;


public class MathUtils {

	public static int combination(int m, int n) {
		if (n == 0 || m == 0) {
			return 1;
		}
		if (n > m) {
			return 0;
		}
		if (n > m / 2) {
			n = m - n;
		}
		double a = 0;
		for (int i = m; i >= (m - n + 1); i--) {
			a += Math.log(i);
		}
		for (int i = n; i >= 1; i--) {
			a -= Math.log(i);
		}
		a = Math.exp(a);
		return (int) Math.round(a);
	}
	
}
